package com.huangfu.learning.javabase.java.pattern.create.abstractfactory;

/**
 * 奔驰工厂类，覆盖所有奔驰车型的构造方法 不能是抽象类
 */
public class BenzFactory extends AbstractFactoryCar {

    @Override
    Car getCar(String type) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
        Class clazz = Class.forName("com.huangfu.learning.javabase.java.pattern.create.abstractfactory."+type);
        return (BenzCar) clazz.newInstance();
    }
}
